﻿CREATE TABLE [dbo].[SolicitudCotizacion] (
    [Id]             INT             IDENTITY (1, 1) NOT NULL,
    [EmpresaId]      INT             NOT NULL,
    [ClienteId]      INT             NULL,
    [UsuarioId]      INT             NULL,
    [VendedorId]     INT             NULL,
    [MaterialId]     INT             NULL,
    [LineaId]        INT             NULL,
    [Fecha]          DATETIME        NULL,
    [TipoProductoId] INT             NULL,
    [Producto]       VARCHAR (100)   NULL,
    [ProductoBase]   DECIMAL (10, 2) NULL,
    [ProductoAltura] DECIMAL (10, 2) NULL,
    [ProductoFondo]  DECIMAL (10, 2) NULL,
    [MaterialBase]   DECIMAL (10, 2) NULL,
    [MaterialAltura] DECIMAL (10, 2) NULL,
    [MaterialFondo]  DECIMAL (10, 2) NULL,
    [Tintas1Cara]    INT             NULL,
    [Tintas2Cara]    INT             NULL,
    [Cuatricromia]   BIT             NULL,
    [Troquel]        BIT             NULL,
    [Cantidades]     VARCHAR (100)   NULL,
    [Observaciones]  VARCHAR (500)   NULL,
    [Rendimiento]    DECIMAL (10, 2) NULL,
    [Montaje]        DECIMAL (10, 2) NULL,
    [Cubrimiento]    DECIMAL (10, 2) NULL,
    [CotizacionId]   INT             NULL,
    [Aplicada]       BIT             NOT NULL,
    [Despiece]       BIT             NULL,
    CONSTRAINT [PK_SolicitudCotizacion] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [FK_SolicitudCotizacion_Cliente] FOREIGN KEY ([ClienteId]) REFERENCES [dbo].[Cliente] ([Id]),
    CONSTRAINT [FK_SolicitudCotizacion_Empresa] FOREIGN KEY ([EmpresaId]) REFERENCES [dbo].[Empresa] ([Id]),
    CONSTRAINT [FK_SolicitudCotizacion_Linea] FOREIGN KEY ([LineaId]) REFERENCES [dbo].[Linea] ([Id]),
    CONSTRAINT [FK_SolicitudCotizacion_Material] FOREIGN KEY ([MaterialId]) REFERENCES [dbo].[Material] ([Id]),
    CONSTRAINT [FK_SolicitudCotizacion_TipoProducto] FOREIGN KEY ([TipoProductoId]) REFERENCES [dbo].[TipoProducto] ([Id]),
    CONSTRAINT [FK_SolicitudCotizacion_Usuario] FOREIGN KEY ([UsuarioId]) REFERENCES [dbo].[Usuario] ([Id]),
    CONSTRAINT [FK_SolicitudCotizacion_Vendedor] FOREIGN KEY ([VendedorId]) REFERENCES [dbo].[Vendedor] ([Id])
);

